package gdut.community.entity;

import java.util.HashMap;
import java.util.Map;

public class Event {
    //事件的类型，Kafka主题，点赞，关注，评论
    private String topic;

    //触发事件的用户
    private int userId;

    //触发的事件目标的类型，点赞的是用户还是博客，还是评论
    private int entityType;

    //出发事件的目标id，
    private int entityId;

    //触发的目标（帖子）作者
    private int entityUserId;

    //额外数据，具有扩展性
    private Map<String,Object> data=new HashMap<>();

    public String getTopic() {
        return topic;
    }

    public Event setTopic(String topic) {
        this.topic = topic;
        return this;
    }

    public int getUserId() {
        return userId;
    }

    public Event setUserId(int userId) {
        this.userId = userId;
        return this;
    }

    public int getEntityType() {
        return entityType;
    }

    public Event setEntityType(int entityType) {
        this.entityType = entityType;
        return this;
    }

    public int getEntityId() {
        return entityId;
    }

    public Event setEntityId(int entityId) {
        this.entityId = entityId;
        return this;
    }

    public int getEntityUserId() {
        return entityUserId;
    }

    public Event setEntityUserId(int entityUserId) {
        this.entityUserId = entityUserId;
        return this;
    }

    public Map<String, Object> getData() {
        return data;
    }

    public Event setData(String key,Object value) {
        this.data.put(key,value);
        return this;
    }

    public Event setData(Map<String, Object> data) {
        this.data = data;
        return this;
    }
}
